﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using FluentValidation;
using CashFlow.Web.Models;
using CashFlow.Web.Common;

namespace CashFlow.Web.Validator
{
    public class UpdatePwdModelValidator : AbstractValidator<UpdatePwdModel>
    {
        public UpdatePwdModelValidator()
        {
            RuleFor(x => x.OldPwd).Must(x => RegExpTool.IsPassword(x))
                .WithMessage("密码格式不正确！");
            RuleFor(x => x.NewPwd).Must(x => RegExpTool.IsPassword(x))
                .WithMessage("新密码格式不正确！");
            RuleFor(x => x.ConfirmNewPwd).Equal(x => x.NewPwd).WithMessage("确认新密码和新密码不一致！");
        }
    }
}